package mysql

import "gorm.io/gorm"

// 商品库存表
type Inventory struct {
	gorm.Model
	GoodsId int32 `gorm:"column:goods_id;type:int(11);not null;index;comment:商品id"`
	Stock   int32 `gorm:"column:stock;type:int(11);default:0;comment:商品库存"`
	Version int32 `gorm:"column:version;type:int(11);comment:版本号"`
	Freeze  int32 `gorm:"column:freeze;type:int(11);comment:冻结库存"`
}

// 订单扣减库存记录表
type OrderInventorySell struct {
	gorm.Model
	OrderSn string `gorm:"type:varchar(100);not null;comment:订单号"`
	GoodsID int32  `gorm:"type:int(11);index;not null;comment:商品id" `
	Stocks  int32  `gorm:"type:int(11);not null;default:0;comment:库存数量"`
	Status  int8   `gorm:"type:tinyint(1);not null;default:1;comment:1:扣减完成 2:归还库存（扣减失败）"`
}
